import request from '@/utils/request'

export function getSupplierCustomer(query) {
  return request({
    url: '/customer-service-consume/query',
    method: 'get',
    params: query
  })
}

// 获取客户列表
export function getCustomerBySupplier(query) {
  return request({
    url: '/customer/getCustomerBySupplier',
    method: 'post',
    params: query
  })
}

// 获取客户服务流水
export function getServicesHistory(query) {
  return request({
    url: '/customer/getServicesHistory',
    method: 'post',
    params: query
  })
}
// 获取客户服务流水
export function getServicesConsumeHistory(query) {
  return request({
    url: '/customer/service-history',
    method: 'get',
    params: query
  })
}

export function getServicesBySupplierID(supplierID) {
  return request({
    url: `/serviceDef/services/supplier/${supplierID}`,
    method: 'get'
  })
}

export function getSpecServices(params) {
  return request({
    url: `/serviceDef/services`,
    method: 'get',
    params
  })
}

// 添加服务流水
export function saveServicesHistory(data) {
  return request({
    url: '/customer/saveServicesHistory',
    method: 'post',
    data
  })
}
// 添加服务流水
export function createServicesHistory(data) {
  return request({
    url: '/customer/service-history',
    method: 'post',
    data
  })
}

// 修改服务流水
export function updateServicesHistory(data) {
  return request({
    url: '/customer/updateServicesHistory',
    method: 'post',
    data
  })
}

export function downloadBlob(params) {
  return request({
    url: '/excel/downloadSupplierCust',
    method: 'get',
    params,
    responseType: 'blob'
  })
}
